const Sequelize = require('sequelize');
let sequelize = require('./db.js').webAccount;
//创建model
let Room = sequelize.define('meeting_room', {
    id: {
        type: Sequelize.INTEGER,
        primaryKey: true,
        autoIncrement: true
    },
    name: {
        type: Sequelize.STRING
    },
    reserve: {
        type: Sequelize.INTEGER,
    },
    enable: {
        type: Sequelize.INTEGER,
    },
    city: {
        type: Sequelize.STRING
    },
    capacity: {
        type: Sequelize.INTEGER,
    },
    address: {
        type: Sequelize.STRING
    },
    createdAt: {
        type: Sequelize.DATE
    },
    updateAt: {
        type: Sequelize.DATE
    }
}, {   
        underscored: true,//将驼峰名转为下划线的格式
        freezeTableName: false,//freezeTabelName 为 true 时不会在库中映射表时增加复数表名
        timestamps: false      // this will deactivate the timestamp columns
    });
//sync() 会返回一个 Promise 对象,force = true 时会把存在的表先 drop 掉再创建
module.exports = Room.sync({ force: false });